
/**
 * @file BaseTestFun.h
 * 
 * @author shikang999@126.com
 * @brief 本库作为函数解加偏的继承类
 * @version 0.1
 * @date 2025-06-23
 * 
 * @copyright Copyright (c) 2025
 * 
 */
#pragma once
#include "BaseFun.h"

namespace Solver
{

class BaseTestFun : public BaseFun
{
public:
    BaseTestFun(std::size_t dim, FunType_E type, DifficultyLevel_E diffLevel, const std::string &name, const std::string &description);
    virtual ~BaseTestFun();

    //设置偏移量
    bool setOffset(VectorXd_t &offset);

    //获取最优解
    const VectorXd_t &getBestX() final;

    //最小化函数
    value_t calcFun(const VectorXd_t &x) final;

    //存储信息到文件
    virtual void write(File &fw) const;

    //从文件读取信息
    virtual void read(File &fr);

protected:
    //需要重载此目标函数
    virtual value_t calcMinFun(const VectorXd_t &x) = 0;

protected:
    VectorXd_t temp_;
    VectorXd_t offset_;//偏移量
};

}